<%--
  Created by IntelliJ IDEA.
  User: ZXW
  Date: 2022/4/26
  Time: 16:30
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>收藏夹主页</title>




  <!-- 静态包含base标签 jQuery文件 -->
  <%@include file="/pages/common/head.jsp"%>
  <link rel="stylesheet" href="static/css/common.css">
  <link rel="stylesheet" href="static/css/blog_list.css">
<script type="text/javascript">
  $(function (){
  //         // 给 【删除】绑定单击事件
  //          $("a.deleteBlog").click(function (){
  //          return confirm("你确定删除这篇文章吗？");
  // });

           $("a.showBlog").click(function (){
             console.log(${sessionScope.blog.id});
             $.getJSON("http://localhost:8080/CSDN/user/favourServlet","action=queryFavourByBlogId&blogId=${sessionScope.blog.id}",function (data){});

           });
  });

</script>


</head>
<body>
<!-- 导航栏 -->
<div class="nav">
  <img src="image/log.png" alt="">
  <span class="title">我的收藏夹</span>
  <!-- 使用 span 把左右两侧的元素给撑开 -->
  <span class="spacer"></span>
  <a href="index.jsp">主页</a>
  <a href="blogServlet?action=page&username=${sessionScope.user.username}">返回我的主页</a>
  <a href="userServlet?action=logout">注销</a>
</div>
<!-- 版心 -->
<div class="container">
  <!-- 左侧区域，显示用户信息 -->
  <div class="container-left">
    <!-- 用户详情 -->
    <div class="card">
      <!-- 用户的头像 -->
      <img src="image/head.jpg" alt="">
      <!-- 用户名 -->
      <h3 name="username">${sessionScope.user.username}</h3>
      <input type="hidden" name="userId" value="${sessionScope.user.id}">
<%--      <!-- 其它信息 -->--%>
<%--      <a href="https://blog.csdn.net/weixin_51367845?type=blog">CSDN 地址</a>--%>
<%--      <a  href="#">GitHub 地址</a>--%>

    </div>
  </div>
  <!-- 右侧区域，显示博客列表 -->
  <div class="container-right">
    <!-- 每个 blog 代表一篇博客 -->
    <c:if test="${not empty sessionScope.blogs}">
    <c:forEach items="${sessionScope.blogs}" var="blogs">

    <div class="blog">
<%--      <div class="title">${blogs.count}</div>--%>
<%--      <div class="date">2022-2-16</div>--%>
<%--  style="width: 180px ;height: 200px; border: red solid 1px "--%>
      <div   class="desc">

        ${blogs.content}
      </div><br/>
      <div class="favour">
        点赞数：${blogs.favour}
      </div>


      <a class="showBlog" href="blogServlet?action=querySingleBlog&blogId=${blogs.id}" class="detail">查看全文&gt;&gt;</a>

    </div>
    </c:forEach>
    </c:if>
    <c:if test="${empty sessionScope.blogs}">目前你的收藏夹为空！</c:if>
  </div>
</div>
</body>
</html>
